package com.jzo2o.customer.service.impl;

import com.jzo2o.common.constants.UserType;
import com.jzo2o.customer.model.dto.request.InstitutionRegisterReqDTO;
import com.jzo2o.customer.service.IRegisterService;
import com.jzo2o.customer.service.IServeProviderService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Liu
 */
@Service
public class RegisterServiceImpl implements IRegisterService {
    @Resource
    private IServeProviderService serveProviderService;
    @Resource
    private PasswordEncoder passwordEncoder;
    @Override
    public void register(InstitutionRegisterReqDTO dto) {
        String password = passwordEncoder.encode(dto.getPassword());
        serveProviderService.add(dto.getPhone(), UserType.INSTITUTION,password);
    }
}
